<style type="text/css">
    .pageFormContent{
        padding-top:20px;
        padding-left:5px;
    }
    .pageFormContent .adRight label {
        width: 100%;
        height: 26px;
        line-height: 26px;
    }
</style>
<script>
    /**
     *验证输入价格
     * @param {type} event
     * @returns {undefined}
     */
    function validateProduct(event) {
        var price = $(event).val(),
                patten = /\.\d{3}/;
        if (patten.test(price)) {
            var price_array = price.split('.');
            var number_pri = price_array[1].substr(0, 2);
            var price_la = price_array[0].concat('.').concat(number_pri);
            $(event).val(price_la);
        }
    }
</script>
<div class="pageContent">
    <form method="post" action="{:url('Gift/edit')}" class="pageForm" onsubmit="return validateCallback(this, dialogAjaxDone)">
        <div layoutH="58">
            <div class="pageFormContent">
                <input type="hidden" name="id" class="required" value="{$gift.id}" />
                <div class="unit">
                    <label>礼物名称：</label>
                    <input type="text" name="gift_name" maxlength="200" class="required" value="{$gift.gift_name}" />
                </div>
                <div class="unit">
                    <label>图片：</label>
                    {:widget('Upload/image', ['gift_img', $gift.gift_img])}
                </div>
                <div class="unit">
                    <label>礼物价格：</label>
                    <input type="text" name="gift_price" class="required number" value="{$gift.gift_price}" onkeyup="javascript:validateProduct(this);" onpropertychange="javascript:validateProduct(this);"/>
                </div>
                <div class="unit">
                    <label>排序：</label>
                    <input type="text" name="sort" size="3" maxlength="3" class="digits" value="{$gift.sort}" />
                </div>
            </div>
        </div>
        <div class="formBar">
            <ul>
                <li><div class="buttonActive"><div class="buttonContent"><button type="submit">提交</button></div></div></li>
                <li><div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div></li>
            </ul>
        </div>
    </form>
</div>